{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "1fcd8d4c",
   "metadata": {},
   "source": [
    "# 微分方程\n",
    "\n",
    "因为有些东西不适合在论文中写，所以写在这里。这也算是对论文的扩展和补充，也是对那些什么都不知道的人解释一些基本概念。\n",
    "\n",
    "markdown中粗斜体：\\boldsymbol{}。\n",
    "\n",
    "\n",
    "![数学领域](assets/数学领域.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9b6fe9b5",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ca117d0a",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "ebdfe2c6",
   "metadata": {},
   "source": [
    "## 常微分方程"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1f40efb2",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c5c3ebaa",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7111e979",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "ca270548",
   "metadata": {},
   "source": [
    "## 偏微分方程"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "958ee284",
   "metadata": {},
   "source": [
    "按照数学发展史年表，1747年达朗贝尔(Jean le Rond d'Alembert, 1717-1783)发表论文《张紧的弦振动时形成的曲线的研究》并提出达朗贝尔方法求解一类二阶偏微分方程而开创了偏微分方程论，至今已有275年的历史了。偏微分方程起初的研究直接来源于物理与几何的问题，但是现在已经发展成了一个独立的数学分支，是当代数学的一个重要的组成部分，是把纯粹数学和自然科学以及工程技术等领域联系起来的桥梁。近几十年来，该领域的研究工作，特别是对非线性偏微分方程的理论、应用以及计算方法的研究，十分活跃。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c09e2090",
   "metadata": {},
   "source": [
    "一个偏微分方程(Partial Differential Equation, PDE)是与一个未知的多元函数及它的偏导数有关的方程；一个偏微分方程组(Partial Differential Equations, PDEs)是与多个未知的多元函数及它们的偏导数有关的方程组。方程中所出现未知函数偏导数的最高阶数，称为该方程的阶；方程中所出现的自变量的个数，称为方程的维数。一般把偏微分方程分为线性偏微分方程和非线性偏微分方程；在线性偏微分方程中，又分为常系数、变系数、齐次和非齐次偏微分方程；非线性的又分为拟线性偏微分方程和完全非线性偏微分方程。习惯上把数学、物理及工程技术中应用最广泛的二阶偏微分方程称为数学物理方程，其中最有名的就是拉普拉斯方程、热传导方程和波动方程，他们都是二阶线性偏微分方程，位势方程(或Poisson方程)是椭圆型的，热传导方程是抛物型的，波动方程是双曲型的。\n",
    "\n",
    "我们把方程的解必须要满足的事先给定的条件叫做定解条件，一个方程配备上定解条件就构成一个定解问题。常见的定解条件有初始条件和边界条件两大类，相应的定解问题叫初值问题和边值问题。初值问题又叫Cauchy问题；边值问题则根据未知函数在边界上的值的类型而分为三类，分别是Dirichlet(狄利克雷)问题、Neumann(诺伊曼)问题和Robin(罗宾)问题。\n",
    "\n",
    "若某函数具有偏微分方程中所出现的各阶连续偏导数，且代入方程后成为一个恒等式，则称此函数为该偏微分方程的一个解（古典解）。一般情况下，偏微分方程的解有无穷多个，只有当解满足一定的初始条件和边界条件（总称为定解条件）时，它才是唯一的。实际问题中，我们总是在一定的定解条件下求解偏微分方程的定解问题。如果一个偏微分方程定解问题满足下列条件：(1) (解的存在性问题)它的解存在；(2) (解的唯一性问题)它的解唯一；(3) (解的稳定性问题)它的解连续地依赖定解问题和定解条件中的已知函数；则称这个定解问题是适定的；否则称这个定解问题是不适定的。\n",
    "偏微分方程定解问题的导出方法有两种。一种方法是变分法。另一种方法是基于自然界三大守恒定律（质量守恒、动量守恒、能量守恒）的推导方法。第二种方法更具有普遍性，但用这种方法导出的方程往往不封闭（即未知函数的个数大于方程的个数），要使方程封闭，往往需要补充针对具体问题用实验方法导出的经验方程。\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7bb4cd76",
   "metadata": {},
   "source": [
    "### 偏微分方程的求解方法\n",
    "\n",
    "1. 解析法\n",
    "\n",
    "一些简单的偏微分方程，例如Transport Equation、Laplace Equation、Heat Equation、low dimensional Wave Equation等，可以直接得出解析解。一些常用的方法有分离变量法、特征线法、常数变易法、Fourier变换法、行波法、降阶法等。\n",
    "\n",
    "解析法可以直接求出部分偏微分方程定解问题的通解，可解释性强，有强烈的物理含义，但是应用范围有限，很难推广到一般的偏微分方程上去，大部分偏微分方程是如此之难，以至于解析解是求不出来的，所以不得不去寻找近似解、数值解，有了计算机后，人们开始发展微分方程数值解法。\n",
    "\n",
    "2. 数值法\n",
    "\n",
    "数值方法求解偏微分方程在工程实际中应用非常广泛，任何问题总可以找到数值解。传统数值方法主要是有限元方法、有限体积法和有限差分法。其他数值解法还有正交配置法、微扰法、变分法、辛积分格式、多重网格法、共轭梯度法等等。下面主要介绍一下有限元方法和有限差分法。\n",
    "\n",
    "有限元方法（Finite Element Method，简称FEM）是使用有限元方法来分析静态或动态的物理物体或物理系统进行的分析方法。有限元分析是使用有限元方法来分析静态或动态的物理物体或物理系统。在这种方法中一个物体或系统被分解为由多个相互联结的、简单、独立的点组成的几何模型。在这种方法中这些独立的点的数量是有限的，因此被称为有限元。由实际的物理模型中推导出来得平衡方程式被使用到每个点上，由此产生了一个方程组。这个方程组可以用线性代数的方法来求解。有限元分析的精确度无法无限提高。元的数目到达一定高度后解的精确度不再提高，只有计算时间不断提高。\n",
    "\n",
    "有限差分法（Finite Difference Method，简称FDM）是一种微分方程数值方法，是通过有限差分来近似导数，从而寻求微分方程的近似解。具体地讲，差分法就是把微分用有限差分代替，把导数用有限差商代替，从而把基本方程和边界条件（一般均为微分方程）近似地改用差分方程（代数方程）来表示，把求解微分方程的问题改换成为求解代数方程的问题。\n",
    "\n",
    "无论从理论还是从处理实际问题工具的角度来说，有限差分方法依然是介绍偏微分方程数值解法的出发点，椭圆型方程领域有限元方法占主导地位，而在逼近许多双曲型问题时有限体积法更占优势。有限体积法是介于有限元法和有限差分法之间的方法，既可以从广义Galerkin法出发也可以从积分插值法出发建立，是有限差分法和有限元方法间有用的桥梁。\n",
    "\n",
    "数值方法在逆问题求解、复杂几何区域求解、高维空间求解等方面都面临着很大的挑战，要么有网格的数值方法需要在偏微分方程的平面区域或者立体表面建立网格，这对于高维问题是复杂甚至不可能的；要么无网格数值方法如径向基函数法，已经被证明是不稳定的。而且，如果初值条件或边界条件或所研究系统的几何形状发生了变化，就必须重新开始求解。随着问题越来越复杂，从设计火箭发动机到模拟气候变化，对于特别复杂的偏微分方程，可能需要几周甚至数月时间才能求解出来一个结果。数值方法遇到了难以克服的困难，偏微分方程的求解似乎陷入了困境。\n",
    "\n",
    "3. 深度学习方法\n",
    "\n",
    "物理信息神经网络(physics-informed neural networks)、基于Feynman-Kac公式的方法(methods based on the Feynman-Kac formula)和基于反向随机微分解决方案的方法(methods based on the solution of backward stochastic differential equations)是最近几年来三种主要的深度学习方法，它们的简单性和对高维问题的适用性很有吸引力。需要说明的是，本文只涉及物理信息神经网络。\n",
    "\n",
    "人工神经网络早在20多年前就被用于求解常微分方程和偏微分方程，但受限于当时的计算方法和计算资源，这一技术并未得到足够的重视。随着数据和计算资源的爆炸式增长，以神经网络为基础的深度学习技术在众多领域取得了革命性的成果。美国布朗大学应用数学系的Karniadakis教授及其合作者们重新审视了这一技术，在原有的基础上进行扩展，提出了一套深度学习算法框架，将其命名为“Physics-informed Neural Networks”。 PINN提出后，引发了大量的后续研究工作，并逐渐成为科学机器学习（Scientific Machine Learning，SciML）这一新兴交叉领域的研究热点。\n",
    "\n",
    "经典的机器学习算法都以纯数据驱动为主，训练一个有监督的机器学习模型的任务就是建立输入数据到输出数据之间的函数映射，即从事先获得的训练数据和事先定义好的算法结构中学习一个具体模型，其好坏与训练数据或分布息息相关。而在许多物理和工程领域场景中，这些训练数据常常隐含部分先验知识，但这部分知识并未体现在经典的机器学习算法中。物理信息神经网络算法，正是结合了数据驱动的机器学习和物理模型的优势，能在少量训练数据的条件下，训练出自动满足物理约束条件的模型，在保证精度的同时具有更好的泛化性能，能够对模型的重要物理参数进行预测。\n",
    "\n",
    "PINN利用了神经网络的逼近理论和自动微分技术，具有无网格的特点，一定程度上能够避免传统数值方法中的维数灾难现象。PINN融合了数据和物理模型先验知识，有助于降低神经网络的复杂度和对训练数据量的需求，实验结果也显示PINN对于逼近遵循一定物理定律的稀疏数据非常有效，能够避免传统神经网络在逼近稀疏数据时的过拟合现象。\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e0ea4230",
   "metadata": {},
   "source": [
    "### 偏微分方程的基本概念\n",
    "\n",
    "\n",
    "**[偏微分方程](Partial differential equation)**是包含未知函数的偏导数(或偏微分)的方程。方程中所出现未知函数偏导数的最高阶数，称为该方程的阶。在数学、物理及工程技术中应用最广泛的，是二阶偏微分方程，习惯上把这些方程称为数学物理方程。\n",
    "\n",
    "\n",
    "\n",
    "**定义 1.1** 一个**偏微分方程**是与一个未知的多元函数及它的偏导数有关的方程；一个**偏微分方程组**是与多个未知的多元函数及它们的偏导数有关的方程组。\n",
    "\n",
    "设 $Ω$ 是 $R^n$ 中的一个集合，$x=(x_1,x_2,\\dots,x_n)$ 表示 $Ω$ 上的点。假设 $u=u(x):Ω \\rightarrow R$ 是一个函数。对固定正整数 $k$，我们用符号 $D^k u$ 表示 $u$ 的所有 $k$ 阶偏导数 $\\large \\frac {\\partial^k u} {\\partial x_{i_1}\\partial x_{i_2} \\cdots \\partial x_{i_k}}$，其中 $(i_1,i_2,\\cdots,i_k)$ 是集合 $\\{1,2,\\cdots,n\\}$ 中 $k$ 个元素的任意排列。$D^k u$ 可以被看成是 $n^k$ 维欧氏空间 $R^{n^k}$ 上的向量。\n",
    "\n",
    "特别的，当 $k=1$ 时，我们称 $n$ 维向量 $\\large Du = (\\frac {\\partial u} {\\partial x_1}, \\frac {\\partial u} {\\partial x_2}, \\cdots, \\frac {\\partial u} {\\partial x_n})$ 为 $u$ 的**梯度**；\n",
    "\n",
    "当 $k=2$ 时，我们称 $n \\times n$ 矩阵\n",
    "$$\n",
    "\\Large\n",
    "D^2u = \\left[ \\begin{matrix}\n",
    "\\frac {\\partial^2 u} {\\partial x^2_1} &  \\frac {\\partial^2 u} {\\partial x_1 \\partial x_2} &  \\cdots &  \\frac {\\partial^2 u} {\\partial x_1 \\partial x_n} \\\\\n",
    "\\frac {\\partial^2 u} {\\partial x_2 \\partial x_1} &  \\frac {\\partial^2 u} {\\partial x^2_2} &  \\cdots &  \\frac {\\partial^2 u} {\\partial x_2 \\partial x_n} \\\\\n",
    "\\vdots & \\vdots & \\ddots & \\vdots                 \\\\\n",
    "\\frac {\\partial^2 u} {\\partial x_n \\partial x_1} &  \\frac {\\partial^2 u} {\\partial x_n \\partial x_2} &  \\cdots &  \\frac {\\partial^2 u} {\\partial x^2_n} \\\\\n",
    "\\end{matrix} \\right]\n",
    "$$\n",
    "为 $u$ 的**Hessian 矩阵**；通常记符号 $\\Delta$ 为 Laplace 算子，$\\large \\Delta u = tr(D^2 u) = \\sum^n_{i=1} \\frac {\\partial^2 u} {\\partial x^2_i}$，也就是 Hessian 矩阵的迹—— $u$ 的Hessian 矩阵的对角线元素之和。\n",
    "\n",
    "设 $\\bf F \\mit= (F_1, F_2, \\cdots, F_n): Ω \\rightarrow R^n$ 是一个向量函数，记 $\\bf F$ 的**散度**为 $\\large div \\bf F \\mit= \\sum^n_{i=1} \\frac {\\partial^2 F_i} {\\partial x_i}$。于是 $\\Delta u$ 是 $u$ 的梯度的散度，即 $\\large \\Delta u = div(Du)$。又记 $\\large u_{x_i} = \\frac {\\partial u} {\\partial x_i}, u_{x_ix_j} = \\frac {\\partial^2 u} {\\partial x_i \\partial x_j}$。\n",
    "\n",
    "\n",
    "\n",
    "**定义 1.2** 如下形式的方程\n",
    "$$\n",
    "\\large F[D^k u(x), D^{k-1} u(x), \\cdots, D u(x), u(x), x] = 0, x \\in Ω\n",
    "$$\n",
    "称为一个**k阶偏微分方程**，其中 $\\large F:R^{n^k} \\times R^{n^{k-1}} \\times \\cdots \\times R^n \\times R \\times Ω \\rightarrow R$ 是一个给定函数， $u: Ω \\rightarrow R$ 是一个未知函数。一个偏微分方程的**阶**就是此偏微分方程中出现的未知函数的偏导数的最高次数。满足方程(2)的所有函数称为方程(2)的**解**。用 $C^k(Ω)$ 表示 $Ω$ 上所有 $k$ 阶偏导数都存在和连续的函数构成的线性空间，即在 $Ω$ 上 $k$ 次连续可微的函数构成的线性空间。如果 $u \\in C^k(Ω)$ 且满足方程(2)，则我们称它是方程(2)的**古典解**。论文中所提到的解都是古典解。\n",
    "\n",
    "\n",
    "\n",
    "**定义 1.3** (1) 如果方程(2)可表示成 $\\large \\sum_{|\\alpha| \\le k} a_{\\alpha}(x) D^{\\alpha} u = f(x)$，其中 $a_{\\alpha} (|\\alpha| \\le k)$ 和 $f$ 是给定的函数，则称方程(2)为**线性偏微分方程**；\n",
    "\n",
    "(2) 如果方程(2)可表示成 $\\large \\sum_{|\\alpha| = k} a_{\\alpha}(x) D^{\\alpha} u = f[D^{k-1} u(x), \\cdots, D u(x), u(x), x]$，其中 $a_{\\alpha} (|\\alpha|=k)$ 和 $f$ 是给定的函数，则称方程(2)为**半线性偏微分方程**；\n",
    "\n",
    "(3) 如果方程(2)可表示成 $\\large \\sum_{|\\alpha| = k} a_{\\alpha} [D^{k-1} u(x), \\cdots, D u(x), u(x), x] D^{\\alpha} u = f[D^{k-1} u(x), \\cdots, D u(x), u(x), x]$，其中 $a_{\\alpha} (|\\alpha| = k)$ 和 $f$ 是给定的函数，则称方程(2)为**拟线性偏微分方程**；\n",
    "\n",
    "(4) 如果方程(2)非线性地依赖于 $u(x)$ 的最高阶偏导数 $D^k u$，则称方程(2)为**完全非线性偏微分方程**。\n",
    "\n",
    "\n",
    "\n",
    "**叠加原理**：几种不同因素同时出现时所产生的效果等于各个因素分别单独出现时所产生的效果的叠加。满足叠加原理的现象在偏微分方程中的模型就是线性微分方程。\n",
    "\n",
    "\n",
    "\n",
    "**定义 1.4** 我们把方程的解必须要满足的事先给定的条件叫做**定解条件**，一个方程配备上定解条件就构成一个**定解问题**。常见的定解条件有`初始条件(Cauchy 条件`)和`边界条件`两大类，相应的定解问题叫`初值问题(Cauchy 问题)`和`边值问题`。\n",
    "\n",
    "(1) **第一类边值问题**，也叫 Dirichlet(狄利克雷) 问题，即给出未知函数在边界上的值(称为**第一类边界条件**)。\n",
    "\n",
    "(2) **第二类边值问题**，也叫 Neumann(诺伊曼) 问题，即给出未知函数在边界上的法向微商的值(称为**第二类边界条件**)。\n",
    "\n",
    "(3) **第三类边值问题**，也叫 Robin(罗宾) 问题，即给出未知函数在边界上的法向微商和本身的线性组合的值(称为**第三类边界条件**)。\n",
    "\n",
    "\n",
    "\n",
    "**定义 1.5** 如果一个偏微分方程定解问题满足下列条件：\n",
    "\n",
    "(1) (解的存在性问题)它的解存在；\n",
    "\n",
    "(2) (解的唯一性问题)它的解唯一\n",
    "\n",
    "(3) (解的稳定性问题)它的解连续地依赖定解问题和定解条件中的已知函数，\n",
    "\n",
    "则称这个定解问题是**适定**的；否则称这个定解问题是**不适定**的。\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "### 偏微分方程实例\n",
    "\n",
    "\n",
    "#### 线性偏微分方程\n",
    "\n",
    "较著名的一些线性偏微分方程有：\n",
    "\n",
    "1. Laplace 方程(二阶线性常系数方程)\n",
    "\n",
    "$$\n",
    "\\large \\Delta u = 0;\n",
    "$$\n",
    "\n",
    "2. 特征值方程\n",
    "\n",
    "$$\n",
    "\\large \\Delta u + \\lambda u= 0 \\ \\ \\ (\\lambda为常数);\n",
    "$$\n",
    "\n",
    "3. 热方程(二阶线性常系数方程)\n",
    "\n",
    "$$\n",
    "\\large u_t - a^2\\Delta u = 0 \\ \\ \\  (a>0为常数);\n",
    "$$\n",
    "\n",
    "4. Schrodinger 方程\n",
    "\n",
    "$$\n",
    "\\large u_t - i \\Delta u = 0;\n",
    "$$\n",
    "\n",
    "5. Kolmogorov方程\n",
    "\n",
    "$$\n",
    "\\large u_t - \\sum^n_{i,j=1} a_{ij} u_{x_i x_j} + \\sum^n_{i=1} b_i u_{x_i} = 0 \\ \\ \\  (a_{ij},b_i为常数,i,j=1,2,\\cdots,n);\n",
    "$$\n",
    "\n",
    "6. Fokker-Planck方程\n",
    "\n",
    "$$\n",
    "\\large u_t - \\sum^n_{i,j=1} (a_{ij} u)_{x_i x_j} + \\sum^n_{i=1} (b_i u)_{x_i} = 0 \\ \\ \\  (a_{ij},b_i为常数,i,j=1,2,\\cdots,n);\n",
    "$$\n",
    "\n",
    "7. 输运方程(一阶线性常系数方程)\n",
    "\n",
    "$$\n",
    "\\large u_t + \\sum^n_{i=1} b_i u_{x_i} = 0 \\ \\ \\  (b_i为常数,i=1,2,\\cdots,n);\n",
    "$$\n",
    "\n",
    "8. 波动方程(二阶线性常系数方程)\n",
    "\n",
    "$$\n",
    "\\large u_{tt} - a^2\\Delta u = 0 \\ \\ \\  (a>0为常数);\n",
    "$$\n",
    "\n",
    "9. 电报方程\n",
    "\n",
    "$$\n",
    "\\large u_{tt} - a^2\\Delta u + bu_t= 0 \\ \\ \\  (a>0,a、b为常数);\n",
    "$$\n",
    "\n",
    "10. 横梁方程\n",
    "\n",
    "$$\n",
    "\\large u_{t} - u_{xxxx} = 0;\n",
    "$$\n",
    "\n",
    "#### 非线性偏微分方程\n",
    "\n",
    "较著名的一些非线性偏微分方程有：\n",
    "\n",
    "1. 非线性 Poisson 方程(二阶非线性常系数方程)\n",
    "\n",
    "$$\n",
    "\\large \\Delta u = u^3 - u;\n",
    "$$\n",
    "\n",
    "2. 极小曲面方程\n",
    "\n",
    "$$\n",
    "\\large div {\\Big (}\\frac{Du}{(1+|Du|^2)^{\\frac{1}{2}}}{\\Big )} = 0;\n",
    "$$\n",
    "\n",
    "3. Monge-Ampere方程\n",
    "\n",
    "$$\n",
    "\\large det(D^2 u)=f(x);\n",
    "$$\n",
    "\n",
    "4. Hamilton-Jacobi方程\n",
    "\n",
    "$$\n",
    "\\large u_{t} + H(Du) = 0\\,\\,\\,\\,(其中H:\\boldsymbol{R}^n \\to \\boldsymbol{R} 为已知函数);\n",
    "$$\n",
    "\n",
    "5. Burgers方程\n",
    "\n",
    "$$\n",
    "\\large u_{t} - uu_{x} = 0;\n",
    "$$\n",
    "\n",
    "6. 守恒律方程(一阶拟线性)\n",
    "\n",
    "$$\n",
    "\\large u_t + div \\boldsymbol{F} (u) = 0;\n",
    "$$\n",
    "\n",
    "7. 多孔介质方程\n",
    "\n",
    "$$\n",
    "\\large u_{t} - \\Delta u^{\\gamma} = 0\\,\\,\\,\\,(\\gamma>1为常数);\n",
    "$$\n",
    "\n",
    "8. Korteweg-de Vries(KdV)方程(三阶拟线性方程)\n",
    "\n",
    "$$\n",
    "\\large u_t + u u_x + u_{xxx} = 0;\n",
    "$$\n",
    "\n",
    "9. p-Laplace方程\n",
    "\n",
    "$$\n",
    "\\large div(|Du|^{p-2} Du)=0\\ \\ \\ \\ (p>1为常数);\n",
    "$$\n",
    "\n",
    "10. 非线性波动方程\n",
    "\n",
    "$$\n",
    "\\large u_{tt} - a^2 \\Delta u = f(x) \\ \\ \\  (a>0为常数);\n",
    "$$\n",
    "\n",
    "11. Boltzmann方程\n",
    "\n",
    "$$\n",
    "\\large f_t + \\boldsymbol{v} \\cdot D_x f = Q(f,f), 其中f=f(x,\\boldsymbol{v} , t);\n",
    "$$\n",
    "\n",
    "#### 线性偏微分方程组\n",
    "\n",
    "较著名的一些线性偏微分方程组有：\n",
    "\n",
    "1. 线性弹性平衡方程组\n",
    "\n",
    "$$\n",
    "\\large \\mu \\Delta \\boldsymbol{u} + (\\lambda+\\mu)D (div\\, \\boldsymbol{u}) = \\boldsymbol{0}\\,\\,\\,\\,(\\mu,\\lambda>0为常数);\n",
    "$$\n",
    "\n",
    "2. 线性弹性发展方程组\n",
    "\n",
    "$$\n",
    "\\large \\boldsymbol{u}_{tt} - \\mu \\Delta \\boldsymbol{u} - (\\lambda+\\mu)D (div\\, \\boldsymbol{u}) = \\boldsymbol{0}\\,\\,\\,\\,(\\mu,\\lambda为常数);\n",
    "$$\n",
    "\n",
    "3. Maxwell方程组\n",
    "\n",
    "$$\n",
    "\\large\n",
    "\\begin{cases}\n",
    "\\begin{aligned}\n",
    "\\frac{1}{c} \\cdot \\frac{\\partial \\boldsymbol{E}}{\\partial t } &=  \\mathrm{curl} \\, \\boldsymbol{B}, \\\\\n",
    "\\frac{1}{c} \\cdot \\frac{\\partial \\boldsymbol{B}}{\\partial t } &= -\\mathrm{curl} \\, \\boldsymbol{E}, \\\\\n",
    "\\mathrm{div}\\,\\boldsymbol{E} &= 0, \\\\\n",
    "\\mathrm{div}\\,\\boldsymbol{B} &= 0, \\\\\n",
    "\\end{aligned}\n",
    "\\end{cases}\n",
    "\\\\这里c为光速，\\boldsymbol{E}为电场强度,\\boldsymbol{B}为磁场强度.\n",
    "$$\n",
    "\n",
    "#### 非线性偏微分方程组\n",
    "\n",
    "较著名的一些非线性偏微分方程组有：\n",
    "\n",
    "1. 守恒律方程组\n",
    "\n",
    "$$\n",
    "\\large \\boldsymbol{u}_{t}+[\\boldsymbol{F}(\\boldsymbol{u})]_{x} = \\boldsymbol{0};\n",
    "$$\n",
    "\n",
    "2. 反应扩散方程组(二阶半线性)\n",
    "\n",
    "$$\n",
    "\\large \\boldsymbol{u}_{t} - a^2 \\Delta \\boldsymbol{u}= \\boldsymbol{f}(\\boldsymbol{u})\\,\\,\\,\\,(a>0为常数);\n",
    "$$\n",
    "\n",
    "3. Euler 方程组(不可压无粘性流)\n",
    "\n",
    "$$\n",
    "\\large\n",
    "\\begin{cases}\n",
    "\\begin{aligned}\n",
    "\\boldsymbol{u}_t + \\boldsymbol{u} \\cdot D\\boldsymbol{u} - \\mu \\Delta\\boldsymbol{u} &= -Dp, \\\\\n",
    "\\mathrm{div}\\,\\boldsymbol{u} &= 0, \\\\\n",
    "\\end{aligned}\n",
    "\\end{cases}\n",
    "其中\\mu 为粘性系数，\\boldsymbol{u},p 分别为流体的速度和压力.\n",
    "$$\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f6d8c976",
   "metadata": {},
   "source": [
    "参考文献：\n",
    "\n",
    "[1]陈祖墀.偏微分方程 第四版[M].高等教育出版社.2018.6.ISBN: 978-7-0404-9458-7.\n",
    "\n",
    "[2]Lu Lu, Xuhui Meng, Zhiping Mao, and George Em Karniadakis. DeepXDE: A Deep Learning Library for Solving Differential Equations. doi: 10.1137/19M1274067.\n",
    "\n",
    "[3]李野,陈松灿.基于物理信息的神经网络：最新进展与展望[J].计算机科学,2022,49(04):254-262.\n",
    "\n",
    "[4]Carl B. Boyer, Uta C. Merzbach.数学史[M].中央编译出版社.2012.5.ISBN: 978-7-5117-0444-3.\n",
    "\n",
    "[5]周蜀林.偏微分方程[M].北京大学出版社.2005.8.ISBN: 978-7-3010-8529-5.\n",
    "\n",
    "[6]张振宇,张立杜. 偏微分方程讲义[M].复旦大学出版社.2011.11.ISBN: 978-7-3090-8537-2.\n",
    "\n",
    "[7]Lawrence C. Evans. Partial Differential Equations 2nd ed.[M]. American Mathematical Society.2010.3.ISBN: 978-0-8218-4974-3.\n",
    "\n",
    "[8]K. W. Morton, D. F. Mayers著,李治平等译.偏微分方程数值解 第二版[M].人民邮电出版社.2006.1.ISBN: 978-7-1151-4203-0.\n",
    "\n",
    "[9]陆金甫.偏微分方程数值解法 第二版[M].清华大学出版社2004.1.ISBN: 978-7-3020-7529-5.\n",
    "\n",
    "[10]李荣华.偏微分方程数值解法 第二版[M].高等教育出版社.2010.11.ISBN: 978-7-0403-0729-0.\n",
    "\n",
    "[11]Jan Blechschmidt, Oliver G. Ernst.Three Ways to Solve Partial Differential Equations with Neural Networks -- A Review. arXiv:2102.11802 \n",
    "\n",
    "[12]I. E. Lagaris, A. Likas and D. I. Fotiadis, \"Artificial neural networks for solving ordinary and partial differential equations,\" in IEEE Transactions on Neural Networks, vol. 9, no. 5, pp. 987-1000, Sept. 1998, doi: 10.1109/72.712178.\n",
    "\n",
    "[13]Maziar Raissi, Paris Perdikaris, George Em Karniadakis.Physics Informed Deep Learning (Part I): Data-driven Solutions of Nonlinear Partial Differential Equations.arXiv preprint arXiv:1711.10561 (2017).\n",
    "\n",
    "[14]Raissi, Maziar, Paris Perdikaris, and George Em Karniadakis.Physics Informed Deep Learning (Part II): Data-driven Discovery of Nonlinear Partial Differential Equations. arXiv preprint arXiv:1711.10566 (2017).\n",
    "\n",
    "[15]Raissi, Maziar, Paris Perdikaris, and George E. Karniadakis. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics 378 (2019): 686-707.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9161d586",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "id": "91fec029",
   "metadata": {},
   "source": [
    "补充 分数阶微积分。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "62de875b",
   "metadata": {},
   "source": [
    "## 分数阶微积分\n",
    "\n",
    "简单来说，经典的微积分运算是指整数阶的微分 $D^n$ 或积分 $I^n$，分数阶微积分就是将整数阶的微积分运算推广到分数阶的微分或积分运算。这里的“分数阶”不仅仅指的是有理分数，也包括阶数为无理数和复数的情形。\n",
    "$$\n",
    "\\large\n",
    "\\begin{aligned}\n",
    "I^nf(t) &= \\frac{1}{(n-1)!}\\int_0^t (t-\\tau)^{n-1}f(\\tau) d\\tau, &n\\in\\mathbb{N}^+,\\\\\n",
    "D^{-\\mu} f(t) &= I^{\\mu} f(t) = \\frac{1}{\\Gamma(\\mu)}\\int_0^t (t-\\tau)^{\\mu-1}f(\\tau) d\\tau, &\\Re(\\mu)>0, \\\\\n",
    "D^{-n} f(t) &= \\frac{1}{\\Gamma(n)} \\frac{d^n}{dt^n} \\left( \\int_0^t (t-\\tau)^{n-1}f(\\tau) d\\tau \\right)  ,&n\\in\\mathbb{N}^+,\\\\\n",
    "D^{\\mu} f(t) &= \\frac{(-1)^n}{\\Gamma(n-\\mu)} \\frac{d^n}{dt^n}\\left( \\int_0^t (\\tau-t)^{n-\\mu-1}u(\\tau) d\\tau \\right), &\\Re(\\mu)>0, n=\\lceil \\mu \\rceil. \\\\\n",
    "\\end{aligned}\\\\\n",
    "$$\n",
    "\n",
    "$\\text{Gamma}$ 函数: \n",
    "$$\n",
    "\\large\n",
    "\\begin{aligned}\n",
    "\\Gamma (z) &= \\int_0^{\\infty} e^{-t}z^{z-1}dt,   &\\Re(z)>0\\\\\n",
    "    &=\\lim_{n\\to\\infty} \\frac{n!n^z}{z(z+1)\\dots(z+n)}\n",
    "    =\\frac{1}{z}\\prod^{\\infty}_{k=0} \\frac{(1+\\frac{1}{k})^z}{1+\\frac{z}{k}}. &(z\\neq-n)\\\\\n",
    "\\end{aligned}\\\\\n",
    "$$\n",
    "\n",
    "按照教科书上的定义："
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4f47035f",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "### $\\text{Grunwald-Letnikov}$ 型分数阶微积分\n",
    "\n",
    "$$\n",
    "\\large \n",
    "\\begin{aligned}\n",
    "\\text{G-L型分数阶导数: }\\\\\n",
    "{_{\\,\\,\\,\\,a}^{GL}}D^{\\mu}_t u(t) &= \\lim_{h\\to0} u^{(\\mu)}_h (t)\n",
    "\\overset{\\text{def}}{=} \\lim_{h\\to 0^+, nh=t-a} h^{-\\mu} \\sum^n_{i=0}\n",
    "\\begin{bmatrix} -\\mu\\\\i \\end{bmatrix} u(t-ih), \\\\\n",
    "&= \\sum^m_{k=0}\\frac{u^{(k)}(a)(t-a)^{-\\mu+k}}{\\Gamma(-\\mu+k+1)} +\\frac{1}{\\Gamma(-\\mu+m+1)} \n",
    "\\int_a^t (t-\\tau)^{-\\mu+m} u^{(m+1)}(\\tau) d\\tau\n",
    ".\\\\\n",
    "\\text{G-L型分数阶积分: }\\\\\n",
    "{_{\\,\\,\\,\\,a}^{GL}}D^{-\\mu}_t u(t) & \\overset{\\text{def}}{=} \\lim_{h\\to 0, nh=t-a}h^{\\mu} \\sum^n_{i=0}\n",
    "\\begin{bmatrix} -\\mu\\\\i \\end{bmatrix} u(t-ih), \\\\\n",
    "&= \\frac{1}{\\Gamma(\\mu)} \\int_a^t (t-\\tau)^{\\mu-1} u(\\tau) d\\tau,\\\\\n",
    "&= \\sum^m_{k=0}\\frac{u^{(k)}(a)(t-a)^{\\mu+k}}{\\Gamma(\\mu+k+1)} +\\frac{1}{\\Gamma(\\mu+m+1)} \n",
    "\\int_a^t (t-\\tau)^{\\mu+m} u^{(m+1)}(\\tau) d\\tau.\\\\\\\\\n",
    "其中\\begin{bmatrix} -\\mu\\\\i \\end{bmatrix} &=  \\frac{(-\\mu)\\bullet(-\\mu+1) \\bullet (-\\mu+2) \\bullet \\dots \\bullet (-\\mu+i-1)} {i!}, \\\\\n",
    "&t\\in(a,b),\\mu\\in\\mathbb{R}^+, m至少取到[\\mu],\\mu\\in[m,m+1). \\\\\n",
    "\\end{aligned}\\\\\n",
    "$$\n",
    "\n",
    "\n",
    "G-L型不常用，目前常用的是 R-L，Caputo, Weyl型导数的定义。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "1886a27e",
   "metadata": {},
   "source": [
    "### $\\text{Riemann-Liouvile}$ 型分数阶微积分\n",
    "\n",
    "$$\n",
    "\\large \\begin{aligned}\n",
    "&&&&&&\\\\\n",
    "\\text{左R-L型分数阶积分:}\\\\\n",
    "\\sideset{_a}{_t^{-\\mu}}D u(t) &= \\frac{1}{\\Gamma(\\mu)}\\int_a^t (t-\\tau)^{\\mu-1}u(\\tau) d\\tau. \\\\\n",
    "\\text{左R-L型分数阶导数:}\\\\\n",
    "\\sideset{_a}{_t^{\\mu}}D u(t) &= D^n[\\sideset{_a}{_t^{-(n-\\mu)}}D u(t)]  \\\\\n",
    "&= \\frac{(-1)^n}{\\Gamma(n-\\mu)} \\frac{d^n}{dt^n}\\left( \\int_a^t (\\tau-t)^{n-\\mu-1}u(\\tau) d\\tau \\right). \\\\\n",
    "\\text{右R-L型分数阶积分:}\\\\\n",
    "\\sideset{_t}{_b^{-\\mu}}D u(t) &= \\frac{1}{\\Gamma(\\mu)}\\int_t^b (\\tau-t)^{\\mu-1}u(\\tau) d\\tau. \\\\\n",
    "\\text{右R-L型分数阶导数:}\\\\\n",
    "\\sideset{_t}{_b^{\\mu}}D u(t) &= (-D)^n[\\sideset{_t}{_b^{\\mu-n}}D u(t)]  \\\\\n",
    "&= \\frac{(-1)^n}{\\Gamma(n-\\mu)} \\frac{d^n}{dt^n}\\left( \\int_t^b (\\tau-t)^{n-\\mu-1}u(\\tau) d\\tau \\right). \\\\\n",
    "其中\\mu>0, n=\\lceil \\mu & \\rceil, t\\in(a,b). \\\\\n",
    "\\end{aligned}\\\\\n",
    "$$\n",
    "\n",
    "R-L型对G-L定义进行了改进，是G-L型的扩充。R-L型可以简化分数阶微积分的计算过程，是应用较为广泛的一种。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5d3b76cc",
   "metadata": {},
   "source": [
    "### $\\text{Caputo}$ 型分数阶微积分\n",
    "\n",
    "$$\n",
    "\\large \\begin{aligned}\n",
    "t\\in(a,b),\\mu>0,n&=\\lceil \\mu \\rceil, n-1<\\mu \\leq n, u^{(n)}是函数u的n阶导数.\\\\\n",
    "\\text{左Caputo型分数阶导数:}\\\\\n",
    "定义1：\n",
    "\\sideset{_a^C}{_t^{\\mu}}D u(t) &= \\sideset{_a}{_t^{\\mu-n}}D  D^n u(t) \n",
    "    =\\frac{1}{\\Gamma(n-\\mu)} \\int_a^t (t-\\xi)^{n-\\mu-1} u^{(n)}(\\xi)d\\xi \\\\\n",
    "    &=\\frac{u^{(n)}(a)(t-a)^{n-\\mu}}{\\Gamma(n-\\mu+1)} + \\frac{1}{\\Gamma(n-\\mu+1)} \\int_a^t (t-\\xi)^{n-\\mu} u^{(n+1)}(\\xi) d\\xi .\\\\\n",
    "定义2：\n",
    "(\\sideset{_a^C}{_t^{\\mu}}D u)(t) &= \\left( \\sideset{_a}{_t^{\\mu}}D  \\left[u(t) - \\sum_{k=0}^{n-1} \\frac{u^{(k)}(a)}{k!} (t-a)^k \\right] \\right) (t).\\\\\n",
    "\\text{右Caputo型分数阶导数:}\\\\\n",
    "定义1：\n",
    "\\sideset{_t^C}{_b^{\\mu}}D u(t) &= \\sideset{_t}{_b^{\\mu-n}}D  (-D)^n u(t) \\\\\n",
    "    &=\\frac{1}{\\Gamma(n-\\mu)} \\int_t^b (\\xi-t)^{n-\\mu-1} (-1)^n u^{(n)}(\\xi)d\\xi .\\\\\n",
    "定义2：\n",
    "(\\sideset{_t^C}{_b^{\\mu}}D u)(t) &= \\left( \\sideset{_t}{_b^{\\mu}}D  \\left[ u(t) - \\sum_{k=0}^{n-1} \\frac{u^{(k)}(b)}{k!} (b-t)^k \\right] \\right) (t).\\\\\n",
    "\\text{左Caputo型分数阶积分:}\\\\\n",
    "没有定义.&或者说与R-L相同\\\\\n",
    "\\text{右Caputo型分数阶积分:}\\\\\n",
    "没有定义.&或者说与R-L相同\\\\\n",
    "\\end{aligned}\\\\\n",
    "$$\n",
    "\n",
    "与R-L型定义相比，Caputo型定义将对函数 $u$ 的整数阶导数放进积分内，改为对变量 $\\xi$ 的导数。\n",
    "\n",
    "在许多的物理、力学等实际问题的数学建模及求解过程中，更多地选择Caputo型导数定义。\n",
    "\n",
    "R-L型分数阶微分可以简化分数阶导数的计算；Caputo型分数阶导数让其Lapace变化更简洁，有利于分数阶微分方程的求解与分析。Caputo型分数阶导数的优越性在于分数阶微分系统的初始条件上，定义采取了与整数阶微分方程相同的形式，包括整数阶导数值对于未知函数在端点t=a的值的限制等等，而R-L型分数阶微分不具有上述好的特点。\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "604fa337",
   "metadata": {},
   "source": [
    "### $\\text{Weyl}$ 型分数阶微积分\n",
    "\n",
    "$$\n",
    "\\large \n",
    "\\begin{aligned}\n",
    "&&&&&&\\\\\n",
    "\\text{Weyl型分数阶积分: }\\\\\n",
    "{_t}W^{-\\mu}_{\\infty} u(t) &= W^{-\\mu} u(t) = \\frac{1}{\\Gamma(\\mu)}\\int_t^{\\infty} (\\tau-t)^{\\mu-1}u(\\tau) d\\tau,  \\\\\n",
    "记E=-D=-\\frac{d}{dt}&,则E^n = (-1)^n D^n,\\\\\n",
    "\\text{Weyl型分数阶导数: }\\\\\n",
    "W^{\\mu} u(t) &= E^n[W^{-(n-\\mu)} u(t)],  \\\\\n",
    "   &= \\frac{(-1)^n}{\\Gamma(n-\\mu)} \\frac{d^n}{dt^n} \\left( \\int_t^{\\infty} (\\tau-t)^{n-\\mu-1}u(\\tau) d\\tau \\right)\\\\\n",
    "其中 \\Re(\\mu) >0,n&=[\\mu]+1, t>0,u\\in S(\\mathbf{R}^n) 即速降函数.\\\\\n",
    "\\end{aligned}\\\\\n",
    "$$\n",
    "\n",
    "形式上，右R-L型令$b=\\infty$与Weyl型是一致的。Weyl型应用于分形曲线建模。\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9066aecc",
   "metadata": {},
   "source": [
    "### 常用函数\n",
    "\n",
    "$$\n",
    "\\large\n",
    "\\begin{aligned}\n",
    "\\text{Gamma函数: }&\\\\\n",
    "\\Gamma (z) &= \\int_0^{\\infty} e^{-t}z^{z-1}dt,   &\\Re(z)>0\\\\\n",
    "    &=\\lim_{n\\to\\infty} \\frac{n!n^z}{z(z+1)\\dots(z+n)}\n",
    "    =\\frac{1}{z}\\prod^{\\infty}_{k=0} \\frac{(1+\\frac{1}{k})^z}{1+\\frac{z}{k}}. &(z\\neq-n)\\\\\n",
    "\\text{Beta函数: }\\\\\n",
    "B(p,q) &= \\int_0^1 \\tau^{p-1}(1-\\tau)^{q-1}d\\tau,\\Re(p)>0,\\Re(q)>0.\\\\\n",
    "\\text{Laplace变换: }\\mathbf{L}\\\\\n",
    "F(s) &= \\int_0^{+\\infty} f(t)e^{-st}dt. &s=\\beta+i\\omega, t\\in[0,+\\infty)\\\\\n",
    "\\text{Laplace逆变换: }\\mathbf{L}^{-1}\\\\\n",
    "f(t) &= \\frac{1}{2\\pi i}\\int_{\\beta-i\\infty}^{\\beta+i\\infty} F(s)e^{st}ds. &t>0,\\Re(s)>c\\\\\n",
    "\\text{Fourier变换: }\\mathbf{F}\\\\\n",
    "F(\\omega) &= \\int_{-\\infty}^{+\\infty} f(\\tau)e^{-i\\omega \\tau}d\\tau.\\\\\n",
    "\\text{Fourier逆变换: }\\mathbf{F}^{-1}\\\\\n",
    "f(t) &= \\frac{1}{2\\pi}\\int_{-\\infty}^{+\\infty} F(\\omega)e^{i\\omega t}d\\omega.\\\\\n",
    "\\text{Mittag-Leffler函数: }\\\\\n",
    "E_{\\alpha,\\beta}(z) &= \\sum_{k=0}^{\\infty} \\frac{z^k}{\\Gamma(k\\alpha+\\beta)}. &\\alpha>0, \\beta>0, z\\in\\mathbf{C} \\\\\n",
    "\\end{aligned}\\\\\n",
    "$$\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4fcbb762",
   "metadata": {},
   "source": [
    "参考文献：\n",
    "\n",
    "[1]吴强,黄建华.分数阶微积分[M].清华大学出版社.2016.5.ISBN 978-7-302-43546-4.\n",
    "\n",
    "[2]郭柏灵,蒲学科,黄凤辉.分数阶偏微分方程及其数值解[M].科学出版社.2011.11.ISBN 978-7-03-032684-3."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ab53970b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py3.8",
   "language": "python",
   "name": "py3.8"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
